#define ID3LIB_LINKOPTION 1
#include <id3/tag.h>
#include "wx/wx.h" 
#include <iostream>
#include <fstream>
#include <string>
#include "SongListFrame.h"

class SongNode
{
public:
	SongNode(wxString* songPath);
	SongNode(void); //Create Null Node
	~SongNode();
	SongNode *nextSong;
private:
	char title[30];
	char artist[30];
	char album[30];
	wxString *path;
	wxString *tagList;
};

SongNode::SongNode(void){
	
}


SongNode::SongNode(wxString* songPath){
	if(songPath->Contains(".mp3"))
	{
		path = songPath;//May be copying wrong info here.
		
		ID3_Tag myTag;
		myTag.Link(path->char_str());
		ID3_Frame *myFrame;
		if ( myFrame = myTag.Find(ID3FID_TITLE))
		{
			  myFrame->Field(ID3FN_TEXT).Get(title, 30);
		}
		if ( myFrame = myTag.Find(ID3FID_ORIGARTIST))
		{
			  myFrame->Field(ID3FN_TEXT).Get(artist, 30);
		}
		if ( myFrame = myTag.Find(ID3FID_ALBUM))
		{
			  myFrame->Field(ID3FN_TEXT).Get(album, 30);
		}

	}
	else
	{
		//Print out error text
	}
}


class SongList
{
public:
	SongList();
	~SongList();
	void addSong(wxString *songPath);
	wxString *getTitle(SongNode *node);
	wxString *getArtist(SongNode *node);
	wxString *getAlbum(SongNode *node);
	SongNode *lastNode;
private:
	SongNode *rootNode;
	
	

};

SongList::SongList(){
	rootNode = new SongNode();
}

void SongList::addSong(wxString *songPath)
{
	lastNode->nextSong = new SongNode(songPath);

}